package com.example.module_home.Adapter;

import android.support.annotation.Nullable;
import android.util.Log;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.module_home.Entity.UserOperationInfo;
import com.example.module_home.R;

import java.util.List;

/**
 * Created by Administrator on 2018/4/25 0025.
 */

public class AllOperationAdapter extends BaseQuickAdapter<UserOperationInfo,BaseViewHolder> {


    public AllOperationAdapter(@Nullable List<UserOperationInfo> data) {
        super(R.layout.home_item_alloperation, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, UserOperationInfo item) {
        helper.setText(R.id.tv_operate,item.getOperate().substring(0,2))
                .setText(R.id.tv_title,"【"+item.getTitle()+"】")
                .setText(R.id.tv_createdAt,item.getCreatedDate())
                .setText(R.id.tv_kind,"{"+item.getKind()+"}")
                .setText(R.id.tv_user,item.getUserName());
        if(item.getOperate().contains("修改")){
            helper.setTextColor(R.id.tv_operate,mContext.getResources().getColor(R.color.sienna));
        }
        if(item.getOperate().contains("添加")){
            helper.setTextColor(R.id.tv_operate,mContext.getResources().getColor(R.color.crimson));
        }
    }
}
